﻿/*
Commerce by Onex – eCommerce software platform (www.ecommerce.byonex.com)
Copyright (C) 2008-2010 by Onex Group

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 */
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class controls_ctrlPriceChangeGraph : System.Web.UI.UserControl
{
    #region VARIABLES

    string _ProductID;
    string _ProductNameColor = string.Empty;
    string _GraphTextColor = string.Empty;
    string _BackgroundColor = string.Empty;
    string _LinesColor = string.Empty;
    string _GraphLineColor = string.Empty;
    string _BorderColor = string.Empty;

    #endregion VARIABLES

    #region PROPERTIES

    public string ProductNameColor
    {
        get { return string.IsNullOrEmpty(_ProductNameColor) ? "000" : _ProductNameColor.Replace("#", string.Empty); }
        set { _ProductNameColor = value; }
    }

    public string GraphTextColor
    {
        get { return string.IsNullOrEmpty(_GraphTextColor) ? "000" : _GraphTextColor.Replace("#", string.Empty); }
        set { _GraphTextColor = value; }
    }

    public string BackgroundColor
    {
        get { return string.IsNullOrEmpty(_BackgroundColor) ? "FFFFCC" : _BackgroundColor.Replace("#", string.Empty); }
        set { _BackgroundColor = value; }
    }

    public string LinesColor
    {
        get { return string.IsNullOrEmpty(_LinesColor) ? "000" : _LinesColor.Replace("#", string.Empty); }
        set { _LinesColor = value; }
    }

    public string ProductID
    {
        get { return string.IsNullOrEmpty(_ProductID)?"-1":_ProductID; }
        set { _ProductID = value; }
    }

    public string GraphLineColor
    {
        get { return string.IsNullOrEmpty(_GraphLineColor) ? "EC981F" : _GraphLineColor.Replace("#", string.Empty); }
        set { _GraphLineColor = value; }
    }

    public string BorderColor
    {
        get { return string.IsNullOrEmpty(_BorderColor) ? "#F2F2F2" : _BorderColor; }
        set { _BorderColor = value; }
    }

    #endregion PROPERTIES

    #region PAGE EVENTS

    protected void Page_Load(object sender, EventArgs e)
    {
        img.ImageUrl = "../ImageGenerator.ashx?id=" + ProductID.ToString() + "&ProductNameColor=" + ProductNameColor + "&GraphTextColor=" + GraphTextColor + "&BackgroundColor=" + BackgroundColor + "&LinesColor=" + LinesColor + "&GraphLineColor=" + GraphLineColor;
        img.BorderColor = System.Drawing.ColorTranslator.FromHtml(string.IsNullOrEmpty(BorderColor) ? "#F2F2F2" : BorderColor);
    }

    #endregion PAGE EVENTS
}
